
//compile with /clr
#include "stdafx.h"
#include <sstream>
#using<system.dll>


namespace Perceptron{

using namespace System;
using namespace System::IO;
using namespace cli;
using namespace std;
const int bufSize = 5; // predefined buffer size
typedef char carr[1];

array<String^,1>^ read(String ^fileName)
{
	array<String^,1> ^content;
	//array<float,1> ^mat;
	//cli::array<wchar_t,1> ^separator;
	//separator[0] = ',';	

   try 
   {
      Console::WriteLine("trying to open file {0}...", fileName);
      StreamReader^ din = File::OpenText(fileName);
	
      String^ str;
      while ((str = din->ReadLine()) != nullptr) 
      {
         //count++;
         //Console::WriteLine("line {0}: {1}", count, str );
		 
		 //din->ReadBlock(
		 //content += str;
		
		 //content->Split(
		 //str->Split(		  
		content = str->Split(',');
		stringstream s;
		//float x,y,output;

      }	  
   }
   catch (Exception^ e)
   {
      if (dynamic_cast<FileNotFoundException^>(e))
         Console::WriteLine("file '{0}' not found", fileName);
      else
         Console::WriteLine("problem reading file '{0}'", fileName);
   }

   return content;
};



}